﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using thinger.AutomaticStoreMotionModels;

namespace thinger.AutomaticStoreMotionDAL
{
    public class ActualStoreDataService
    {
        #region 获取所有位置数据
        public static List<ActualStoreData> GetActualStoreData()
        {
            return SqlSugarHelper.SqlSugarClient.Queryable<ActualStoreData>().ToList();
        }
        #endregion

        #region 获取存料的数量
        public static int GetAvailableCount()
        {
            return SqlSugarHelper.SqlSugarClient.Queryable<ActualStoreData>().Where(c => c.StoreState == 1).Count();
        }
        #endregion

        #region 根据条形码获取批号
        public static string GetSNCodeByCode(string code)
        {
            var query = SqlSugarHelper.SqlSugarClient.Queryable<ActualStoreData>().Where(c => c.Code == code && c.StoreState == 1).ToList();
            if (query.Count > 0)
            {
                return query[0].Code;
            }
            else
            {
                return string.Empty;
            }
        }
        #endregion
    }
}
